package com.tinem.platform.module.starter.jpa.repository.data;

import com.tinem.platform.module.starter.jpa.entity.data.Areas;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: platform
 * @description: ${description}
 * @author: eden#can
 * @Slogan: 没有所谓失败，除非你不再尝试
 * @date: 2021-12-08 12:26
 **/
@Repository
public interface AreasRepository extends JpaRepository<Areas, Integer> {


    List<Areas> findByLangIdAndParentIdOrderBySortAsc(String lang, String pid);


    List<Areas> findByLangIdOrderBySortAsc(String lang);

    @Query(nativeQuery = true,
            value = "select * from  t_areas WHERE c_lang_id = ?1 and c_parent_id = ?2 and  c_s_id = ?3 order by c_sort asc "
    )
    Areas findByLangIdAndParentIdAndSId(String lang, String pid,String sId);
}